package com.du.algorithm.primary;

/**
 * @desc:
 * @author: shuangdu
 * @date: 2022/12/21
 * @since: 1.8
 */
public class LogTool {

    public static void exec(String title, Func func) {
        long s = System.currentTimeMillis();
        System.out.println(String.format("[ %s ] Start...", title));
        Object o = func.process();
        if (!(o instanceof Void)) {
            System.out.println("返回结果为: " + o);
        }
        System.out.println("耗时:"+ (System.currentTimeMillis() - s) + "ms");
        System.out.println();
    }

    @FunctionalInterface
    interface Func<U> {
        U process();
    }
}
